package requests

import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
)

const executeErrorFmt = `Execute action error:
%d - %s
%s
`

func (h *httpServer) handlerSend(c *gin.Context) {
	for i, action := range h.config.Actions {
		err := action.Execute()
		if err != nil {
			c.String(http.StatusBadRequest, fmt.Sprintf(executeErrorFmt, i+1, action.Type, err.Error()))
			return
		}
	}
}
